Dynomotion

Group: DynoMotion Message: 5779 From: daveymahomh600e Date: 10/11/2012
Subject: Use Kmotion as a Force Sensor?
Hello All,

Is it possible, given the Kflop's ability to monitor the currents inside a servo motor, to use it as a form of pressure switch?

What I am interested in is SLOWLY moving a small machine slide with a blunt tool on it (spinning roller), as in a probing operation, and stopping the X-axis travel when the load starts to increase on the motor because of the slide pressing against a resistance.

Can we measure the increase in servo load to be able to stop this motion within a reasonable amount of travel? The probing speed is about 0.8 ipm.

Typically for this type of machine (metal spinning) the X-axis is on a hydraulic cylinder and this contact point is determined with the use of a pressure switch.

Thanks for your thoughts,
David.
Group: DynoMotion Message: 5780 From: Tom Kerekes Date: 10/11/2012
Subject: Re: Use Kmotion as a Force Sensor?
Hi David,
 
I would suppose that is possible.  It would depend on the characteristics of your system.  For example how much drag would be introduced as compared to how much friction in the system.  You would need to be using our SnapAmp so that KFLOP has direct access to motor currents.  A C program would be required to monitor the currents, maybe perform some sort of filtering, detect a threshold, stop the X axis, etc...
 
Regards
TK

Group: DynoMotion Message: 5781 From: daveymahomh600e Date: 10/11/2012
Subject: Re: Use Kmotion as a Force Sensor?
Thanks Tom.

I am planning to use the SnapAmp to control the servos. I guess I'd better get started learning how to C program.

David

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi David,
>  
> I would suppose that is possible.  It would depend on the characteristics of your system.  For example how much drag would be introduced as compared to how much friction in the system.  You would need to be using our SnapAmp so that KFLOP has direct access to motor currents.  A C program would be required to monitor the currents, maybe perform some sort of filtering, detect a threshold, stop the X axis, etc...
>  
> Regards
> TK
>
>
> ________________________________
> From: daveymahomh600e <david.m.stevenson@...>
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, October 11, 2012 2:18 PM
> Subject: [DynoMotion] Use Kmotion as a Force Sensor?
>
>  
> Hello All,
>
> Is it possible, given the Kflop's ability to monitor the currents inside a servo motor, to use it as a form of pressure switch?
>
> What I am interested in is SLOWLY moving a small machine slide with a blunt tool on it (spinning roller), as in a probing operation, and stopping the X-axis travel when the load starts to increase on the motor because of the slide pressing against a resistance.
>
> Can we measure the increase in servo load to be able to stop this motion within a reasonable amount of travel? The probing speed is about 0.8 ipm.
>
> Typically for this type of machine (metal spinning) the X-axis is on a hydraulic cylinder and this contact point is determined with the use of a pressure switch.
>
> Thanks for your thoughts,
> David.
>
Group: DynoMotion Message: 5783 From: daveymahomh600e Date: 10/12/2012
Subject: Re: Use Kmotion as a Force Sensor?
This routine would only be used as part of a probing operation. The probing area as well as the other system characteristics you noted would be defined by this program. I believe we could measure the current change since the slide drag should be reasonably predictable and consistent.

I will put together a sequence of events and hopefully you can point me at some code examples that I could adapt to this operation.

Thanks again,
David.

--- In DynoMotion@yahoogroups.com, "daveymahomh600e" <david.m.stevenson@...> wrote:
>
> Thanks Tom.
>
> I am planning to use the SnapAmp to control the servos. I guess I'd better get started learning how to C program.
>
> David
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi David,
> >  
> > I would suppose that is possible.  It would depend on the characteristics of your system.  For example how much drag would be introduced as compared to how much friction in the system.  You would need to be using our SnapAmp so that KFLOP has direct access to motor currents.  A C program would be required to monitor the currents, maybe perform some sort of filtering, detect a threshold, stop the X axis, etc...
> >  
> > Regards
> > TK
> >
> >
> > ________________________________
> > From: daveymahomh600e <david.m.stevenson@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Thursday, October 11, 2012 2:18 PM
> > Subject: [DynoMotion] Use Kmotion as a Force Sensor?
> >
> >  
> > Hello All,
> >
> > Is it possible, given the Kflop's ability to monitor the currents inside a servo motor, to use it as a form of pressure switch?
> >
> > What I am interested in is SLOWLY moving a small machine slide with a blunt tool on it (spinning roller), as in a probing operation, and stopping the X-axis travel when the load starts to increase on the motor because of the slide pressing against a resistance.
> >
> > Can we measure the increase in servo load to be able to stop this motion within a reasonable amount of travel? The probing speed is about 0.8 ipm.
> >
> > Typically for this type of machine (metal spinning) the X-axis is on a hydraulic cylinder and this contact point is determined with the use of a pressure switch.
> >
> > Thanks for your thoughts,
> > David.
> >
>
Group: DynoMotion Message: 5786 From: oxforduniv Date: 10/12/2012
Subject: Re: Use Kmotion as a Force Sensor?
You may be able to implement this using the same method that I have used very effectively when using a Motion Card that is similar to Kflop/Kanalog in function, in this application torque mode amplifiers are used, in these drives, the current is directly proportional to the ±10vdc command, so when the system comes to the function you are looking to do, the torque limit is changed in the program and set to whatever value is equal to the required pressure, when this is lower than the continuous torque level, there is no harm to the motor.
The other advantage is there is no need to monitor any motor current.
Tom may confirm if this is possible?
Al.

--- In DynoMotion@yahoogroups.com, "daveymahomh600e" <david.m.stevenson@...> wrote:
>
> Hello All,
>
> Is it possible, given the Kflop's ability to monitor the currents inside a servo motor, to use it as a form of pressure switch?
>
> What I am interested in is SLOWLY moving a small machine slide with a blunt tool on it (spinning roller), as in a probing operation, and stopping the X-axis travel when the load starts to increase on the motor because of the slide pressing against a resistance.
>
> Can we measure the increase in servo load to be able to stop this motion within a reasonable amount of travel? The probing speed is about 0.8 ipm.
>
> Typically for this type of machine (metal spinning) the X-axis is on a hydraulic cylinder and this contact point is determined with the use of a pressure switch.
>
> Thanks for your thoughts,
> David.
>
Group: DynoMotion Message: 5803 From: daveymahomh600e Date: 10/14/2012
Subject: Re: Use Kmotion as a Force Sensor?
Thanks Al.

I will be using the SnapAmp/Kflop combo and to be quite honest, I'm not real strong when it comes down to electrics. The SnapAmp will be the motor controller and I really don't know what exactly it would monitor to let me achieve the force control, but I hope Tom can point me toward the appropriate code to do so.

David

--- In DynoMotion@yahoogroups.com, "oxforduniv" <oxforduniv@...> wrote:
>
> You may be able to implement this using the same method that I have used very effectively when using a Motion Card that is similar to Kflop/Kanalog in function, in this application torque mode amplifiers are used, in these drives, the current is directly proportional to the ±10vdc command, so when the system comes to the function you are looking to do, the torque limit is changed in the program and set to whatever value is equal to the required pressure, when this is lower than the continuous torque level, there is no harm to the motor.
> The other advantage is there is no need to monitor any motor current.
> Tom may confirm if this is possible?
> Al.
>
> --- In DynoMotion@yahoogroups.com, "daveymahomh600e" <david.m.stevenson@> wrote:
> >
> > Hello All,
> >
> > Is it possible, given the Kflop's ability to monitor the currents inside a servo motor, to use it as a form of pressure switch?
> >
> > What I am interested in is SLOWLY moving a small machine slide with a blunt tool on it (spinning roller), as in a probing operation, and stopping the X-axis travel when the load starts to increase on the motor because of the slide pressing against a resistance.
> >
> > Can we measure the increase in servo load to be able to stop this motion within a reasonable amount of travel? The probing speed is about 0.8 ipm.
> >
> > Typically for this type of machine (metal spinning) the X-axis is on a hydraulic cylinder and this contact point is determined with the use of a pressure switch.
> >
> > Thanks for your thoughts,
> > David.
> >
>
Group: DynoMotion Message: 5808 From: Tom Kerekes Date: 10/15/2012
Subject: Re: Use Kmotion as a Force Sensor?
Attachments :
Hi David,
 
I've attached a program to read the SnapAmp Coil currents, filter, and stop if over a threshold.  I didn't test it :}
 
Regards
TK
 
PS I've pasted it here which sometimes doesn't go through email well
 
#define LIMIT 5.0 // Stop when the motor current exceeds 5 Amps
#define TAU 0.002 // do filtering with 2ms Tau
main()
{
      float A,B,C,M,K,M_Filtered=0.0;
      BOOL Done=FALSE;
      K = expf(-2.0*TIMEBASE/TAU);
//    printf("Tau=%f K=%f\n",TAU,K);
     
      while (!Done)
      {
            WaitNextTimeSlice();
           
            // get two of the coil currents
            // SnapAmp measure the A and C phases
            A = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[0]);
            C = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[1]);
            B = -A-C;  // sum of all currents going in must be Zero
 
            // compute total magnitude
            M = sqrtf(A*A+B*B+C*C);
           
            // perform a low pass filter
            M_Filtered = M_Filtered*K + M*(1.0-K);
 
            // check if we should stop
            if (M_Filtered > LIMIT)
            {
                  Jog(0,0.0);  //StopMotion
                  Done=TRUE;
            }
      }
}
 
 
 
 
 

Group: DynoMotion Message: 5810 From: daveymahomh600e Date: 10/15/2012
Subject: Re: Use Kmotion as a Force Sensor?
Hello Tom.

Thank you very much for the code.

I have spent today comparing the C Tutorial (400+ pages) and the KFlop Manual (300+ pages) and the whole world seems a little foggy right now, so please know that I really do appreciate your help!!

In all honesty, I don't yet know where to put the code but I'm sure someone could tell me where to stick it. :}

There were other pieces of code that I think were listed in some of your CNCzone posts which pertain to motor control parameters. Is that code to be setup so it runs each time the system starts, or only to set parameters which remain constant after they have been determined?

Thanks again,
David.

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi David,
>  
> I've attached a program to read the SnapAmp Coil currents, filter, and stop if over a threshold.  I didn't test it :}
>  
> Regards
> TK
>  
> PS I've pasted it here which sometimes doesn't go through email well
>  
> #defineLIMIT 5.0 // Stop when the motor current exceeds 5 Amps
> #defineTAU 0.002 // do filtering with 2ms Tau
> main()
> {
>       float A,B,C,M,K,M_Filtered=0.0;
>       BOOL Done=FALSE;
>       K = expf(-2.0*TIMEBASE/TAU);
> //    printf("Tau=%f K=%f\n",TAU,K);
>      
>       while (!Done)
>       {
>             WaitNextTimeSlice();
>            
>             // get two of the coil currents
>             // SnapAmp measure the A and C phases
>             A = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[0]);
>             C = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[1]);
>             B = -A-C;  // sum of all currents going in must be Zero
>  
>             // compute total magnitude
>             M = sqrtf(A*A+B*B+C*C);
>            
>             // perform a low pass filter
>             M_Filtered = M_Filtered*K + M*(1.0-K);
>  
>             // check if we should stop
>             if (M_Filtered > LIMIT)
>             {
>                   Jog(0,0.0);  //StopMotion
>                   Done=TRUE;
>             }
>       }
> }
>  
>  
>  
>  
>  
>
>
> ________________________________
> From: daveymahomh600e <david.m.stevenson@...>
> To: DynoMotion@yahoogroups.com
> Sent: Sunday, October 14, 2012 1:44 PM
> Subject: [DynoMotion] Re: Use Kmotion as a Force Sensor?
>
>  
> Thanks Al.
>
> I will be using the SnapAmp/Kflop combo and to be quite honest, I'm not real strong when it comes down to electrics. The SnapAmp will be the motor controller and I really don't know what exactly it would monitor to let me achieve the force control, but I hope Tom can point me toward the appropriate code to do so.
>
> David
>
> --- In mailto:DynoMotion%40yahoogroups.com, "oxforduniv" <oxforduniv@> wrote:
> >
> > You may be able to implement this using the same method that I have used very effectively when using a Motion Card that is similar to Kflop/Kanalog in function, in this application torque mode amplifiers are used, in these drives, the current is directly proportional to the ±10vdc command, so when the system comes to the function you are looking to do, the torque limit is changed in the program and set to whatever value is equal to the required pressure, when this is lower than the continuous torque level, there is no harm to the motor.
> > The other advantage is there is no need to monitor any motor current.
> > Tom may confirm if this is possible?
> > Al.
> >
> > --- In mailto:DynoMotion%40yahoogroups.com, "daveymahomh600e" <david.m.stevenson@> wrote:
> > >
> > > Hello All,
> > >
> > > Is it possible, given the Kflop's ability to monitor the currents inside a servo motor, to use it as a form of pressure switch?
> > >
> > > What I am interested in is SLOWLY moving a small machine slide with a blunt tool on it (spinning roller), as in a probing operation, and stopping the X-axis travel when the load starts to increase on the motor because of the slide pressing against a resistance.
> > >
> > > Can we measure the increase in servo load to be able to stop this motion within a reasonable amount of travel? The probing speed is about 0.8 ipm.
> > >
> > > Typically for this type of machine (metal spinning) the X-axis is on a hydraulic cylinder and this contact point is determined with the use of a pressure switch.
> > >
> > > Thanks for your thoughts,
> > > David.
> > >
> >
>
Group: DynoMotion Message: 5811 From: Tom Kerekes Date: 10/15/2012
Subject: Re: Use Kmotion as a Force Sensor?
Hi David,
 
The first step might be to test the concept by running that program from the KMotion C Programs Screen to see if it works.  It will probably need to be tweeked for the actual axis that you end up using and so forth.  Maybe add a Jog command to start the motion.
 
Eventually you will probably want to assign this C program to an M code so you can initiate the "Probe" action from G Code.  Or maybe assign it to a User Button in the KMotionCNC screen.  It is up to you to decide how you expect the machine operation to work. 
 
The C code that is used to initalize the axis parameters and so forth is usually assigned to a User Button in KMotionCNC or the RESET button in Mach3 so the system can be initialized after a system startup or after some fault condition.  We recommend initializing everything from scratch every time rather than flashing settings into the board.  This avoids remembering if/how/when the board was configured long ago and there is really no need or benefit as long as a PC is connected anyway.
 
Regards
TK

Group: DynoMotion Message: 5865 From: daveymahomh600e Date: 10/23/2012
Subject: Re: Use Kmotion as a Force Sensor?
Hi Tom,
My intention is to build this into a probing routine.

The machine will be jogged to the starting position via a joypad and then the user will input 3 pieces of data... the overall width of the area to be probed (X dimension), the amount to pullback in X after we get a touch (current) signal and the amount to stepover in Y to start the next probe stroke. Since this is a lathe, the probing is only 2 dimensional.

Is it possible for you to point me to some existing code that I could massage into a routine such as this?

I am also a bit confused about the AutoPhaseFind program... does this need to run each time the machine is initialized, or just the homing routine?

Thank you,
David.

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi David,
>  
> The first step might be to test the concept by running that program from the KMotion C Programs Screen to see if it works.  It will probably need to be tweeked for the actual axis that you end up using and so forth.  Maybe add a Jog command to start the motion.
>  
> Eventually you will probably want to assign this C program to an M code so you can initiate the "Probe" action from G Code.  Or maybe assign it to a User Button in the KMotionCNC screen.  It is up to you to decide how you expect the machine operation to work. 
>  
> The C code that is used to initalize the axis parameters and so forth is usually assigned to a User Button in KMotionCNC or the RESET button in Mach3 so the system can be initialized after a system startup or after some fault condition.  We recommend initializing everything from scratch every time rather than flashing settings into the board.  This avoids remembering if/how/when the board was configured long ago and there is really no need or benefit as long as a PC is connected anyway.
>  
> Regards
> TK
>
>
> ________________________________
> From: daveymahomh600e <david.m.stevenson@...>
> To: DynoMotion@yahoogroups.com
> Sent: Monday, October 15, 2012 2:38 PM
> Subject: [DynoMotion] Re: Use Kmotion as a Force Sensor?
>
>  
>
>
> Hello Tom.
>
> Thank you very much for the code.
>
> I have spent today comparing the C Tutorial (400+ pages) and the KFlop Manual (300+ pages) and the whole world seems a little foggy right now, so please know that I really do appreciate your help!!
>
> In all honesty, I don't yet know where to put the code but I'm sure someone could tell me where to stick it. :}
>
> There were other pieces of code that I think were listed in some of your CNCzone posts which pertain to motor control parameters. Is that code to be setup so it runs each time the system starts, or only to set parameters which remain constant after they have been determined?
>
> Thanks again,
> David.
>
> --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi David,
> >  
> > I've attached a program to read the SnapAmp Coil currents, filter, and stop if over a threshold.  I didn't test it :}
> >  
> > Regards
> > TK
> >  
> > PS I've pasted it here which sometimes doesn't go through email well
> >  
> > #defineLIMIT 5.0 // Stop when the motor current exceeds 5 Amps
> > #defineTAU 0.002 // do filtering with 2ms Tau
> > main()
> > {
> >       float A,B,C,M,K,M_Filtered=0.0;
> >       BOOL Done=FALSE;
> >       K = expf(-2.0*TIMEBASE/TAU);
> > //    printf("Tau=%f K=%f\n",TAU,K);
> >      
> >       while (!Done)
> >       {
> >             WaitNextTimeSlice();
> >            
> >             // get two of the coil currents
> >             // SnapAmp measure the A and C phases
> >             A = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[0]);
> >             C = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[1]);
> >             B = -A-C;  // sum of all currents going in must be Zero
> >  
> >             // compute total magnitude
> >             M = sqrtf(A*A+B*B+C*C);
> >            
> >             // perform a low pass filter
> >             M_Filtered = M_Filtered*K + M*(1.0-K);
> >  
> >             // check if we should stop
> >             if (M_Filtered > LIMIT)
> >             {
> >                   Jog(0,0.0);  //StopMotion
> >                   Done=TRUE;
> >             }
> >       }
> > }
> >  
> >  
> >  
> >  
> >  
> >
> >
> > ________________________________
> > From: daveymahomh600e <david.m.stevenson@>
> > To: mailto:DynoMotion%40yahoogroups.com
> > Sent: Sunday, October 14, 2012 1:44 PM
> > Subject: [DynoMotion] Re: Use Kmotion as a Force Sensor?
> >
> >  
> > Thanks Al.
> >
> > I will be using the SnapAmp/Kflop combo and to be quite honest, I'm not real strong when it comes down to electrics. The SnapAmp will be the motor controller and I really don't know what exactly it would monitor to let me achieve the force control, but I hope Tom can point me toward the appropriate code to do so.
> >
> > David
> >
> > --- In mailto:DynoMotion%40yahoogroups.com, "oxforduniv" <oxforduniv@> wrote:
> > >
> > > You may be able to implement this using the same method that I have used very effectively when using a Motion Card that is similar to Kflop/Kanalog in function, in this application torque mode amplifiers are used, in these drives, the current is directly proportional to the ±10vdc command, so when the system comes to the function you are looking to do, the torque limit is changed in the program and set to whatever value is equal to the required pressure, when this is lower than the continuous torque level, there is no harm to the motor.
> > > The other advantage is there is no need to monitor any motor current.
> > > Tom may confirm if this is possible?
> > > Al.
> > >
> > > --- In mailto:DynoMotion%40yahoogroups.com, "daveymahomh600e" <david.m.stevenson@> wrote:
> > > >
> > > > Hello All,
> > > >
> > > > Is it possible, given the Kflop's ability to monitor the currents inside a servo motor, to use it as a form of pressure switch?
> > > >
> > > > What I am interested in is SLOWLY moving a small machine slide with a blunt tool on it (spinning roller), as in a probing operation, and stopping the X-axis travel when the load starts to increase on the motor because of the slide pressing against a resistance.
> > > >
> > > > Can we measure the increase in servo load to be able to stop this motion within a reasonable amount of travel? The probing speed is about 0.8 ipm.
> > > >
> > > > Typically for this type of machine (metal spinning) the X-axis is on a hydraulic cylinder and this contact point is determined with the use of a pressure switch.
> > > >
> > > > Thanks for your thoughts,
> > > > David.
> > > >
> > >
> >
>
Group: DynoMotion Message: 5866 From: Tom Kerekes Date: 10/23/2012
Subject: Re: Use Kmotion as a Force Sensor?
Hi David,
 
There could be many approaches to doing something like this depending on how you envision it all working and what your software capabilities are.  For example what would probably be best would be to write your own C# Windows program to interface to the operator, then have the C# program set parameters in KFLOP as the step size and such and then execute a C program in KFLOP to collect all the data, then the C# program would upload all the data and save/display it.
 
But I think the first step would be to test the program I sent previously to see if the technique works regarding probing a single point.
 
And even before that just getting your brushless motor commutated and tuned such that it moves properly.
 
That AutoPhaseFind.c program is only needed one time to diagnose the characteristics of your brushless motor.  From then on after power up all that is needed is to "phase find".  On power up the encoder position will read zero regardless of where the motor rotor is.  To commutate the motor properly we need to set the encoder reading to be absolutely aligned to the rotor.  So a similar technique, but simpler, is used to rotate the rotor until the index pulse is detected and the encoder position is zeroed.  At that point we have everything needed to commutate the motor.  See the HomeBrushless.c examples of how to do this.  There are other possible methods of phase finding, but this is the simplest and is very accurate as it is based on the index pulse of the encoder.
 
Regards
TK
 

Group: DynoMotion Message: 5867 From: daveymahomh600e Date: 10/23/2012
Subject: Re: Use Kmotion as a Force Sensor?
Thanks Tom,

Your Kmotion interface is perfect for my needs. I hope to use a few of the user buttons to accomplish the probing and other functions I may need.

All my Gcode is produced in a separate CAD program. I simply need to be able to probe the mandrel with the tool, export that file to CAD for massaging, then bring it back in to run the machine. It looks to me like KmotionCNC has everything I need.

I hope to have my power supply tomorrow and at that point I can do some preliminary wiring to get things started. Once I have a clearer understanding of how your system works (the C programming I'm still learning) I won't waste so much of your time with these rudimentary questions.

Thanks again,
David.

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi David,
>  
> There could be many approaches to doing something like this depending on how you envision it all working and what your software capabilities are.  For example what would probably be best would be to write your own C# Windows program to interface to the operator, then have the C# program set parameters in KFLOP as the step size and such and then execute a C program in KFLOP to collect all the data, then the C# program would upload all the data and save/display it.
>  
> But I think the first step would be to test the program I sent previously to see if the technique works regarding probing a single point.
>  
> And even before that just getting your brushless motor commutated and tuned such that it moves properly.
>  
> That AutoPhaseFind.c program is only needed one time to diagnose the characteristics of your brushless motor.  From then on after power up all that is needed is to "phase find".  On power up the encoder position will read zero regardless of where the motor rotor is.  To commutate the motor properly we need to set the encoder reading to be absolutely aligned to the rotor.  So a similar technique, but simpler, is used to rotate the rotor until the index pulse is detected and the encoder position is zeroed.  At that point we have everything needed to commutate the motor.  See the HomeBrushless.c examples of how to do this.  There are other possible methods of phase finding, but this is the simplest and is very accurate as it is based on the index pulse of the encoder.
>  
> Regards
> TK
>  
>
> From: daveymahomh600e <david.m.stevenson@...>
> To: DynoMotion@yahoogroups.com
> Sent: Tuesday, October 23, 2012 2:59 PM
> Subject: [DynoMotion] Re: Use Kmotion as a Force Sensor?
>
>  
> Hi Tom,
> My intention is to build this into a probing routine.
>
> The machine will be jogged to the starting position via a joypad and then the user will input 3 pieces of data... the overall width of the area to be probed (X dimension), the amount to pullback in X after we get a touch (current) signal and the amount to stepover in Y to start the next probe stroke. Since this is a lathe, the probing is only 2 dimensional.
>
> Is it possible for you to point me to some existing code that I could massage into a routine such as this?
>
> I am also a bit confused about the AutoPhaseFind program... does this need to run each time the machine is initialized, or just the homing routine?
>
> Thank you,
> David.
>
> --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi David,
> >  
> > The first step might be to test the concept by running that program from the KMotion C Programs Screen to see if it works.  It will probably need to be tweeked for the actual axis that you end up using and so forth.  Maybe add a Jog command to start the motion.
> >  
> > Eventually you will probably want to assign this C program to an M code so you can initiate the "Probe" action from G Code.  Or maybe assign it to a User Button in the KMotionCNC screen.  It is up to you to decide how you expect the machine operation to work. 
> >  
> > The C code that is used to initalize the axis parameters and so forth is usually assigned to a User Button in KMotionCNC or the RESET button in Mach3 so the system can be initialized after a system startup or after some fault condition.  We recommend initializing everything from scratch every time rather than flashing settings into the board.  This avoids remembering if/how/when the board was configured long ago and there is really no need or benefit as long as a PC is connected anyway.
> >  
> > Regards
> > TK
> >
> >
> > ________________________________
> > From: daveymahomh600e <david.m.stevenson@>
> > To: mailto:DynoMotion%40yahoogroups.com
> > Sent: Monday, October 15, 2012 2:38 PM
> > Subject: [DynoMotion] Re: Use Kmotion as a Force Sensor?
> >
> >  
> >
> >
> > Hello Tom.
> >
> > Thank you very much for the code.
> >
> > I have spent today comparing the C Tutorial (400+ pages) and the KFlop Manual (300+ pages) and the whole world seems a little foggy right now, so please know that I really do appreciate your help!!
> >
> > In all honesty, I don't yet know where to put the code but I'm sure someone could tell me where to stick it. :}
> >
> > There were other pieces of code that I think were listed in some of your CNCzone posts which pertain to motor control parameters. Is that code to be setup so it runs each time the system starts, or only to set parameters which remain constant after they have been determined?
> >
> > Thanks again,
> > David.
> >
> > --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi David,
> > >  
> > > I've attached a program to read the SnapAmp Coil currents, filter, and stop if over a threshold.  I didn't test it :}
> > >  
> > > Regards
> > > TK
> > >  
> > > PS I've pasted it here which sometimes doesn't go through email well
> > >  
> > > #defineLIMIT 5.0 // Stop when the motor current exceeds 5 Amps
> > > #defineTAU 0.002 // do filtering with 2ms Tau
> > > main()
> > > {
> > >       float A,B,C,M,K,M_Filtered=0.0;
> > >       BOOL Done=FALSE;
> > >       K = expf(-2.0*TIMEBASE/TAU);
> > > //    printf("Tau=%f K=%f\n",TAU,K);
> > >      
> > >       while (!Done)
> > >       {
> > >             WaitNextTimeSlice();
> > >            
> > >             // get two of the coil currents
> > >             // SnapAmp measure the A and C phases
> > >             A = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[0]);
> > >             C = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[1]);
> > >             B = -A-C;  // sum of all currents going in must be Zero
> > >  
> > >             // compute total magnitude
> > >             M = sqrtf(A*A+B*B+C*C);
> > >            
> > >             // perform a low pass filter
> > >             M_Filtered = M_Filtered*K + M*(1.0-K);
> > >  
> > >             // check if we should stop
> > >             if (M_Filtered > LIMIT)
> > >             {
> > >                   Jog(0,0.0);  //StopMotion
> > >                   Done=TRUE;
> > >             }
> > >       }
> > > }
> > >  
> > >  
> > >  
> > >  
> > >  
> > >
> > >
> > > ________________________________
> > > From: daveymahomh600e <david.m.stevenson@>
> > > To: mailto:DynoMotion%40yahoogroups.com
> > > Sent: Sunday, October 14, 2012 1:44 PM
> > > Subject: [DynoMotion] Re: Use Kmotion as a Force Sensor?
> > >
> > >  
> > > Thanks Al.
> > >
> > > I will be using the SnapAmp/Kflop combo and to be quite honest, I'm not real strong when it comes down to electrics. The SnapAmp will be the motor controller and I really don't know what exactly it would monitor to let me achieve the force control, but I hope Tom can point me toward the appropriate code to do so.
> > >
> > > David
> > >
> > > --- In mailto:DynoMotion%40yahoogroups.com, "oxforduniv" <oxforduniv@> wrote:
> > > >
> > > > You may be able to implement this using the same method that I have used very effectively when using a Motion Card that is similar to Kflop/Kanalog in function, in this application torque mode amplifiers are used, in these drives, the current is directly proportional to the ±10vdc command, so when the system comes to the function you are looking to do, the torque limit is changed in the program and set to whatever value is equal to the required pressure, when this is lower than the continuous torque level, there is no harm to the motor.
> > > > The other advantage is there is no need to monitor any motor current.
> > > > Tom may confirm if this is possible?
> > > > Al.
> > > >
> > > > --- In mailto:DynoMotion%40yahoogroups.com, "daveymahomh600e" <david.m.stevenson@> wrote:
> > > > >
> > > > > Hello All,
> > > > >
> > > > > Is it possible, given the Kflop's ability to monitor the currents inside a servo motor, to use it as a form of pressure switch?
> > > > >
> > > > > What I am interested in is SLOWLY moving a small machine slide with a blunt tool on it (spinning roller), as in a probing operation, and stopping the X-axis travel when the load starts to increase on the motor because of the slide pressing against a resistance.
> > > > >
> > > > > Can we measure the increase in servo load to be able to stop this motion within a reasonable amount of travel? The probing speed is about 0.8 ipm.
> > > > >
> > > > > Typically for this type of machine (metal spinning) the X-axis is on a hydraulic cylinder and this contact point is determined with the use of a pressure switch.
> > > > >
> > > > > Thanks for your thoughts,
> > > > > David.
> > > > >
> > > >
> > >
> >
>
Group: DynoMotion Message: 6185 From: David Stevenson Date: 11/29/2012
Subject: Re: Use Kmotion as a Force Sensor? [1 Attachment]

Hi Tom,
 
I am about to build this into a program to test. What is the best way for me to monitor the motor currents while this runs? I noticed there is a MeasuredAxisAmps(axis) statement. Is it valid for this situation? I was going to use it in a printf statement.
 
Thanks,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Monday, October 15, 2012 5:16 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Re: Use Kmotion as a Force Sensor? [1 Attachment]

 

Hi David,
 
I've attached a program to read the SnapAmp Coil currents, filter, and stop if over a threshold.  I didn't test it :}
 
Regards
TK
 
PS I've pasted it here which sometimes doesn't go through email well
 
#define LIMIT 5.0 // Stop when the motor current exceeds 5 Amps
#define TAU 0.002 // do filtering with 2ms Tau
main()
{
      float A,B,C,M,K,M_Filtered=0.0;
      BOOL Done=FALSE;
      K = expf(-2.0*TIMEBASE/TAU);
//    printf("Tau=%f K=%f\n",TAU,K);
     
      while (!Done)
      {
            WaitNextTimeSlice();
           
            // get two of the coil currents
            // SnapAmp measure the A and C phases
            A = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[0]);
            C = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[1]);
            B = -A-C;  // sum of all currents going in must be Zero
            // compute total magnitude
            M = sqrtf(A*A+B*B+C*C);
           
            // perform a low pass filter
            M_Filtered = M_Filtered*K + M*(1.0-K);
            // check if we should stop
            if (M_Filtered > LIMIT)
            {
                  Jog(0,0.0);  //StopMotion
                  Done=TRUE;
            }
      }
}
 
 
 
 

Group: DynoMotion Message: 6186 From: Tom Kerekes Date: 11/29/2012
Subject: Re: Use Kmotion as a Force Sensor?
Hi David,

No.  That call is for our obsolete KMotion board.  The method for SnapAmp is shown in the previous email.

You might also just use the Step Response Screen and do a slow, small, move into a hard stop and plot the motor currents and see how they react.  Also look at following error.

Regards
TK



From: David Stevenson <david.m.stevenson@...>
To: DynoMotion@yahoogroups.com
Sent: Thursday, November 29, 2012 1:48 PM
Subject: RE: [DynoMotion] Re: Use Kmotion as a Force Sensor?

 

Hi Tom,
 
I am about to build this into a program to test. What is the best way for me to monitor the motor currents while this runs? I noticed there is a MeasuredAxisAmps(axis) statement. Is it valid for this situation? I was going to use it in a printf statement.
 
Thanks,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Monday, October 15, 2012 5:16 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Re: Use Kmotion as a Force Sensor? [1 Attachment]

 
Hi David,
 
I've attached a program to read the SnapAmp Coil currents, filter, and stop if over a threshold.  I didn't test it :}
 
Regards
TK
 
PS I've pasted it here which sometimes doesn't go through email well
 
#define LIMIT 5.0 // Stop when the motor current exceeds 5 Amps
#define TAU 0.002 // do filtering with 2ms Tau
main()
{
      float A,B,C,M,K,M_Filtered=0.0;
      BOOL Done=FALSE;
      K = expf(-2.0*TIMEBASE/TAU);
//    printf("Tau=%f K=%f\n",TAU,K);
     
      while (!Done)
      {
            WaitNextTimeSlice();
           
            // get two of the coil currents
            // SnapAmp measure the A and C phases
            A = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[0]);
            C = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[1]);
            B = -A-C;  // sum of all currents going in must be Zero
            // compute total magnitude
            M = sqrtf(A*A+B*B+C*C);
           
            // perform a low pass filter
            M_Filtered = M_Filtered*K + M*(1.0-K);
            // check if we should stop
            if (M_Filtered > LIMIT)
            {
                  Jog(0,0.0);  //StopMotion
                  Done=TRUE;
            }
      }
}
 
 
 
 

Group: DynoMotion Message: 6190 From: David Stevenson Date: 11/30/2012
Subject: Re: Use Kmotion as a Force Sensor?

Hi Tom,
 
I finally got a chance to run this program and wanted to let you know it works AWESOME!
 
Thank you very much for your help with this,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Thursday, November 29, 2012 4:55 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Re: Use Kmotion as a Force Sensor?

 

Hi David,

No.  That call is for our obsolete KMotion board.  The method for SnapAmp is shown in the previous email.

You might also just use the Step Response Screen and do a slow, small, move into a hard stop and plot the motor currents and see how they react.  Also look at following error.

Regards
TK



From: David Stevenson <david.m.stevenson@...>
To: DynoMotion@yahoogroups.com
Sent: Thursday, November 29, 2012 1:48 PM
Subject: RE: [DynoMotion] Re: Use Kmotion as a Force Sensor?

 

Hi Tom,
 
I am about to build this into a program to test. What is the best way for me to monitor the motor currents while this runs? I noticed there is a MeasuredAxisAmps(axis) statement. Is it valid for this situation? I was going to use it in a printf statement.
 
Thanks,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Monday, October 15, 2012 5:16 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Re: Use Kmotion as a Force Sensor? [1 Attachment]

 
Hi David,
 
I've attached a program to read the SnapAmp Coil currents, filter, and stop if over a threshold.  I didn't test it :}
 
Regards
TK
 
PS I've pasted it here which sometimes doesn't go through email well
 
#define LIMIT 5.0 // Stop when the motor current exceeds 5 Amps
#define TAU 0.002 // do filtering with 2ms Tau
main()
{
      float A,B,C,M,K,M_Filtered=0.0;
      BOOL Done=FALSE;
      K = expf(-2.0*TIMEBASE/TAU);
//    printf("Tau=%f K=%f\n",TAU,K);
     
      while (!Done)
      {
            WaitNextTimeSlice();
           
            // get two of the coil currents
            // SnapAmp measure the A and C phases
            A = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[0]);
            C = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[1]);
            B = -A-C;  // sum of all currents going in must be Zero
            // compute total magnitude
            M = sqrtf(A*A+B*B+C*C);
           
            // perform a low pass filter
            M_Filtered = M_Filtered*K + M*(1.0-K);
            // check if we should stop
            if (M_Filtered > LIMIT)
            {
                  Jog(0,0.0);  //StopMotion
                  Done=TRUE;
            }
      }
}
 
 
 
 

Group: DynoMotion Message: 6208 From: David Stevenson Date: 12/3/2012
Subject: Re: Use Kmotion as a Force Sensor?

Hi Tom,
 
This routine of yours works very well, however, since my motor runs through a 10:1 gearbox, it isn't quite as sensitive as would be ideal. I am finding that if the current is allowed to increase any more than about 0.5 amps above the current used to simply move the slide, that damage is likely on the die.
 
Since the drag on the slide varies due to it's position, mostly because of overhang in my case, I think the ideal way to set the LIMIT value is to measure the max value during the first 1.5 seconds or so of each probe stroke and then add the 0.5 amp to that value and make this the LIMIT to watch.
 
I was looking at the code and don't really understand how the time slice components work. If you have a spare few moments, would you please show me how I could set up the code this way?
 
Thank you in advance,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Thursday, November 29, 2012 4:55 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Re: Use Kmotion as a Force Sensor?

 

Hi David,

No.  That call is for our obsolete KMotion board.  The method for SnapAmp is shown in the previous email.

You might also just use the Step Response Screen and do a slow, small, move into a hard stop and plot the motor currents and see how they react.  Also look at following error.

Regards
TK



From: David Stevenson <david.m.stevenson@...>
To: DynoMotion@yahoogroups.com
Sent: Thursday, November 29, 2012 1:48 PM
Subject: RE: [DynoMotion] Re: Use Kmotion as a Force Sensor?

 

Hi Tom,
 
I am about to build this into a program to test. What is the best way for me to monitor the motor currents while this runs? I noticed there is a MeasuredAxisAmps(axis) statement. Is it valid for this situation? I was going to use it in a printf statement.
 
Thanks,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Monday, October 15, 2012 5:16 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Re: Use Kmotion as a Force Sensor? [1 Attachment]

 
Hi David,
 
I've attached a program to read the SnapAmp Coil currents, filter, and stop if over a threshold.  I didn't test it :}
 
Regards
TK
 
PS I've pasted it here which sometimes doesn't go through email well
 
#define LIMIT 5.0 // Stop when the motor current exceeds 5 Amps
#define TAU 0.002 // do filtering with 2ms Tau
main()
{
      float A,B,C,M,K,M_Filtered=0.0;
      BOOL Done=FALSE;
      K = expf(-2.0*TIMEBASE/TAU);
//    printf("Tau=%f K=%f\n",TAU,K);
     
      while (!Done)
      {
            WaitNextTimeSlice();
           
            // get two of the coil currents
            // SnapAmp measure the A and C phases
            A = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[0]);
            C = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[1]);
            B = -A-C;  // sum of all currents going in must be Zero
            // compute total magnitude
            M = sqrtf(A*A+B*B+C*C);
           
            // perform a low pass filter
            M_Filtered = M_Filtered*K + M*(1.0-K);
            // check if we should stop
            if (M_Filtered > LIMIT)
            {
                  Jog(0,0.0);  //StopMotion
                  Done=TRUE;
            }
      }
}
 
 
 
 

Group: DynoMotion Message: 6209 From: Tom Kerekes Date: 12/3/2012
Subject: Re: Use Kmotion as a Force Sensor?
Hi David,

It might be something like:

First declare some more variables:

double T0,MaxCurrent;

Then initialize them when you start (but not every time in the loop)

T0 = Time_sec() + 1.5;  // determine at what time we should finish looking for max
MaxCurrent=0;

Then in the loop for the first 1.5 sec look for MaxCurrent


if (Time_sec() < T0) //Time to be finding max, or looking to stop??
{
    if (M_Filtered> MaxCurrent) MaxCurrent = M_Filtered;
}
else
{
    if (M_Filtered > MaxCurrent + 0.5)
  { 
      Jog(0,0.0);  //StopMotion
      Done=TRUE;
  }
 
}


HTH
Regards
TK



From: David Stevenson <david.m.stevenson@...>
To: DynoMotion@yahoogroups.com
Sent: Monday, December 3, 2012 9:35 AM
Subject: RE: [DynoMotion] Re: Use Kmotion as a Force Sensor?

 

Hi Tom,
 
This routine of yours works very well, however, since my motor runs through a 10:1 gearbox, it isn't quite as sensitive as would be ideal. I am finding that if the current is allowed to increase any more than about 0.5 amps above the current used to simply move the slide, that damage is likely on the die.
 
Since the drag on the slide varies due to it's position, mostly because of overhang in my case, I think the ideal way to set the LIMIT value is to measure the max value during the first 1.5 seconds or so of each probe stroke and then add the 0.5 amp to that value and make this the LIMIT to watch.
 
I was looking at the code and don't really understand how the time slice components work. If you have a spare few moments, would you please show me how I could set up the code this way?
 
Thank you in advance,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Thursday, November 29, 2012 4:55 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Re: Use Kmotion as a Force Sensor?

 
Hi David,

No.  That call is for our obsolete KMotion board.  The method for SnapAmp is shown in the previous email.

You might also just use the Step Response Screen and do a slow, small, move into a hard stop and plot the motor currents and see how they react.  Also look at following error.

Regards
TK



From: David Stevenson <david.m.stevenson@...>
To: DynoMotion@yahoogroups.com
Sent: Thursday, November 29, 2012 1:48 PM
Subject: RE: [DynoMotion] Re: Use Kmotion as a Force Sensor?

 

Hi Tom,
 
I am about to build this into a program to test. What is the best way for me to monitor the motor currents while this runs? I noticed there is a MeasuredAxisAmps(axis) statement. Is it valid for this situation? I was going to use it in a printf statement.
 
Thanks,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Monday, October 15, 2012 5:16 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Re: Use Kmotion as a Force Sensor? [1 Attachment]

 
Hi David,
 
I've attached a program to read the SnapAmp Coil currents, filter, and stop if over a threshold.  I didn't test it :}
 
Regards
TK
 
PS I've pasted it here which sometimes doesn't go through email well
 
#define LIMIT 5.0 // Stop when the motor current exceeds 5 Amps
#define TAU 0.002 // do filtering with 2ms Tau
main()
{
      float A,B,C,M,K,M_Filtered=0.0;
      BOOL Done=FALSE;
      K = expf(-2.0*TIMEBASE/TAU);
//    printf("Tau=%f K=%f\n",TAU,K);
     
      while (!Done)
      {
            WaitNextTimeSlice();
           
            // get two of the coil currents
            // SnapAmp measure the A and C phases
            A = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[0]);
            C = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[1]);
            B = -A-C;  // sum of all currents going in must be Zero
            // compute total magnitude
            M = sqrtf(A*A+B*B+C*C);
           
            // perform a low pass filter
            M_Filtered = M_Filtered*K + M*(1.0-K);
            // check if we should stop
            if (M_Filtered > LIMIT)
            {
                  Jog(0,0.0);  //StopMotion
                  Done=TRUE;
            }
      }
}
 
 
 
 

Group: DynoMotion Message: 6210 From: David Stevenson Date: 12/3/2012
Subject: Re: Use Kmotion as a Force Sensor?

Thank you Tom.
 
That is exactly what I need.
 
Best regards,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Monday, December 03, 2012 1:00 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Re: Use Kmotion as a Force Sensor?

 

Hi David,

It might be something like:

First declare some more variables:

double T0,MaxCurrent;

Then initialize them when you start (but not every time in the loop)

T0 = Time_sec() + 1.5;  // determine at what time we should finish looking for max
MaxCurrent=0;

Then in the loop for the first 1.5 sec look for MaxCurrent


if (Time_sec() < T0) //Time to be finding max, or looking to stop??
{
    if (M_Filtered> MaxCurrent) MaxCurrent = M_Filtered;
}
else
{
    if (M_Filtered > MaxCurrent + 0.5)
  { 
      Jog(0,0.0);  //StopMotion
      Done=TRUE;
  }
 
}


HTH
Regards
TK



From: David Stevenson <david.m.stevenson@...>
To: DynoMotion@yahoogroups.com
Sent: Monday, December 3, 2012 9:35 AM
Subject: RE: [DynoMotion] Re: Use Kmotion as a Force Sensor?

 

Hi Tom,
 
This routine of yours works very well, however, since my motor runs through a 10:1 gearbox, it isn't quite as sensitive as would be ideal. I am finding that if the current is allowed to increase any more than about 0.5 amps above the current used to simply move the slide, that damage is likely on the die.
 
Since the drag on the slide varies due to it's position, mostly because of overhang in my case, I think the ideal way to set the LIMIT value is to measure the max value during the first 1.5 seconds or so of each probe stroke and then add the 0.5 amp to that value and make this the LIMIT to watch.
 
I was looking at the code and don't really understand how the time slice components work. If you have a spare few moments, would you please show me how I could set up the code this way?
 
Thank you in advance,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Thursday, November 29, 2012 4:55 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Re: Use Kmotion as a Force Sensor?

 
Hi David,

No.  That call is for our obsolete KMotion board.  The method for SnapAmp is shown in the previous email.

You might also just use the Step Response Screen and do a slow, small, move into a hard stop and plot the motor currents and see how they react.  Also look at following error.

Regards
TK



From: David Stevenson <david.m.stevenson@...>
To: DynoMotion@yahoogroups.com
Sent: Thursday, November 29, 2012 1:48 PM
Subject: RE: [DynoMotion] Re: Use Kmotion as a Force Sensor?

 

Hi Tom,
 
I am about to build this into a program to test. What is the best way for me to monitor the motor currents while this runs? I noticed there is a MeasuredAxisAmps(axis) statement. Is it valid for this situation? I was going to use it in a printf statement.
 
Thanks,
David.
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Monday, October 15, 2012 5:16 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Re: Use Kmotion as a Force Sensor? [1 Attachment]

 
Hi David,
 
I've attached a program to read the SnapAmp Coil currents, filter, and stop if over a threshold.  I didn't test it :}
 
Regards
TK
 
PS I've pasted it here which sometimes doesn't go through email well
 
#define LIMIT 5.0 // Stop when the motor current exceeds 5 Amps
#define TAU 0.002 // do filtering with 2ms Tau
main()
{
      float A,B,C,M,K,M_Filtered=0.0;
      BOOL Done=FALSE;
      K = expf(-2.0*TIMEBASE/TAU);
//    printf("Tau=%f K=%f\n",TAU,K);
     
      while (!Done)
      {
            WaitNextTimeSlice();
           
            // get two of the coil currents
            // SnapAmp measure the A and C phases
            A = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[0]);
            C = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[1]);
            B = -A-C;  // sum of all currents going in must be Zero
            // compute total magnitude
            M = sqrtf(A*A+B*B+C*C);
           
            // perform a low pass filter
            M_Filtered = M_Filtered*K + M*(1.0-K);
            // check if we should stop
            if (M_Filtered > LIMIT)
            {
                  Jog(0,0.0);  //StopMotion
                  Done=TRUE;
            }
      }
}
 
 
 
 

Group: DynoMotion Message: 6413 From: daveymahomh600e Date: 1/11/2013
Subject: Re: Use Kmotion as a Force Sensor?
Hi Tom,

If I also wanted to perform the same type of probe with the other axis, could I simply change

A = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[0]);
C = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[1]);

to
A = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[2]);
C = SNAP_CONVERT_ADC_TO_AMPS(ADC_BufferInSnap[3]);

Thanks,
David.

--- In DynoMotion@yahoogroups.com, "David Stevenson" wrote:
>
> Thank you Tom.
>
> That is exactly what I need.
>
> Best regards,
> David.
>
>
Group: DynoMotion Message: 6416 From: Tom Kerekes Date: 1/11/2013
Subject: Re: Use Kmotion as a Force Sensor?
Yes

TK

Group: DynoMotion Message: 6420 From: David Stevenson Date: 1/11/2013
Subject: Re: Use Kmotion as a Force Sensor?

Thank you.
 
David
 
-----Original Message-----
From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]On Behalf Of Tom Kerekes
Sent: Friday, January 11, 2013 12:00 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Re: Use Kmotion as a Force Sensor?

 

Yes

TK